import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/double_control/risk_control_assessment_entity.dart';

RiskControlAssessmentEntity $RiskControlAssessmentEntityFromJson(Map<String, dynamic> json) {
  final RiskControlAssessmentEntity riskControlAssessmentEntity = RiskControlAssessmentEntity();
  final double? analysisCount = jsonConvert.convert<double>(json['analysisCount']);
  if (analysisCount != null) {
    riskControlAssessmentEntity.analysisCount = analysisCount;
  }
  final double? analysisRate = jsonConvert.convert<double>(json['analysisRate']);
  if (analysisRate != null) {
    riskControlAssessmentEntity.analysisRate = analysisRate;
  }
  final String? endDate = jsonConvert.convert<String>(json['endDate']);
  if (endDate != null) {
    riskControlAssessmentEntity.endDate = endDate;
  }
  final double? investigationCount = jsonConvert.convert<double>(json['investigationCount']);
  if (investigationCount != null) {
    riskControlAssessmentEntity.investigationCount = investigationCount;
  }
  final double? investigationRate = jsonConvert.convert<double>(json['investigationRate']);
  if (investigationRate != null) {
    riskControlAssessmentEntity.investigationRate = investigationRate;
  }
  final double? rectificationCount = jsonConvert.convert<double>(json['rectificationCount']);
  if (rectificationCount != null) {
    riskControlAssessmentEntity.rectificationCount = rectificationCount;
  }
  final double? rectificationRate = jsonConvert.convert<double>(json['rectificationRate']);
  if (rectificationRate != null) {
    riskControlAssessmentEntity.rectificationRate = rectificationRate;
  }
  final int? scoreLevel = jsonConvert.convert<int>(json['scoreLevel']);
  if (scoreLevel != null) {
    riskControlAssessmentEntity.scoreLevel = scoreLevel;
  }
  final double? scoreValue = jsonConvert.convert<double>(json['scoreValue']);
  if (scoreValue != null) {
    riskControlAssessmentEntity.scoreValue = scoreValue;
  }
  final String? startDate = jsonConvert.convert<String>(json['startDate']);
  if (startDate != null) {
    riskControlAssessmentEntity.startDate = startDate;
  }
  return riskControlAssessmentEntity;
}

Map<String, dynamic> $RiskControlAssessmentEntityToJson(RiskControlAssessmentEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['analysisCount'] = entity.analysisCount;
  data['analysisRate'] = entity.analysisRate;
  data['endDate'] = entity.endDate;
  data['investigationCount'] = entity.investigationCount;
  data['investigationRate'] = entity.investigationRate;
  data['rectificationCount'] = entity.rectificationCount;
  data['rectificationRate'] = entity.rectificationRate;
  data['scoreLevel'] = entity.scoreLevel;
  data['scoreValue'] = entity.scoreValue;
  data['startDate'] = entity.startDate;
  return data;
}

extension RiskControlAssessmentEntityExtension on RiskControlAssessmentEntity {
  RiskControlAssessmentEntity copyWith({
    double? analysisCount,
    double? analysisRate,
    String? endDate,
    double? investigationCount,
    double? investigationRate,
    double? rectificationCount,
    double? rectificationRate,
    int? scoreLevel,
    double? scoreValue,
    String? startDate,
  }) {
    return RiskControlAssessmentEntity()
      ..analysisCount = analysisCount ?? this.analysisCount
      ..analysisRate = analysisRate ?? this.analysisRate
      ..endDate = endDate ?? this.endDate
      ..investigationCount = investigationCount ?? this.investigationCount
      ..investigationRate = investigationRate ?? this.investigationRate
      ..rectificationCount = rectificationCount ?? this.rectificationCount
      ..rectificationRate = rectificationRate ?? this.rectificationRate
      ..scoreLevel = scoreLevel ?? this.scoreLevel
      ..scoreValue = scoreValue ?? this.scoreValue
      ..startDate = startDate ?? this.startDate;
  }
}
